package cn.wsxiot.display.mapper;

import org.apache.ibatis.annotations.*;
import cn.wsxiot.display.domain.User;

@Mapper
public interface UserMapper {

    @Results({
            @Result(property = "name",column ="name"),
            @Result(property = "age" ,column ="age"),
            @Result(property = "id",column = "age")
    })
    @Select("select * from user where id= #{id}")
    User findById(@Param("id") Long id);

    @Insert("INSERT INTO USER(NAME, AGE) VALUES(#{name}, #{age})")
    int insert(@Param("name") String name, @Param("age") Integer age);

    @Insert("update user set age=#{age},name=#{name} where id =#{id}")
    int update(User user);

    @Delete("delete from user where id=#{id}")
    int delete(Long id);

}